home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 11 / CU Amiga Magazine's Super CD-ROM 11 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-06].iso / s / copyboxcontents.pprx < prev    next >
Text File  |  1993-02-15  |  4KB  |  218 lines

  1. /*
  2. @BCopyBoxContents  @P@ICopyright Gold Disk Inc., Jan, 1993
  3.  
  4. This Genie will copy the contents of a box into other boxes.
  5. */
  6. parse arg source
  7. address command
  8. call SafeEndEdit.rexx()
  9.  
  10. if source = '' then
  11. do
  12.  
  13.     source  = ppm_ClickOnBox("Click on box which has contents to be copied..")
  14.     if source = 0 then exit_msg()
  15.  
  16.    call ppm_SelectBox(source)
  17.  
  18.     counter = 0
  19.  
  20.     do forever
  21.  
  22.       box = ppm_ClickOnBox("Click on boxes to which contents will be copied..")
  23.       if box = 0 then break
  24.  
  25.       call ppm_SelectBox(box)
  26.  
  27.       counter = counter + 1
  28.       boxes.counter = box
  29.  
  30.     end
  31.  
  32.     if counter = 0 then
  33.       exit_msg()
  34.  
  35. end
  36. else
  37. do
  38.  
  39.     if list = '' then exit_msg("Invalid Input")
  40.  
  41.     do counter = 1 to words(list)
  42.  
  43.       boxes.counter = word(list, counter)
  44.  
  45.     end
  46.  
  47. end
  48.  
  49. call ppm_AutoUpdate(0)
  50.  
  51. info  = ppm_GetBoxInfo(source)
  52. fword = upper(word(info, 1))
  53.  
  54. dellist = ''
  55.  
  56. if fword = "TEXT" then
  57. do
  58.    copyfunc = "CopyText"
  59.    text  = ppm_GetArticleText(source, 1)
  60.  
  61. end
  62. else if fword = "EMPTY" then copyfunc = "DelContents"
  63. else if fword = "STRUCTURED" | fword = "CLIP" then
  64. do
  65.    copyfunc = "CopyAll"
  66. end
  67. else if fword = "BITMAP" then
  68. do
  69.    copyfunc = "CopyBitMap"
  70.    bitmapfile = substr(info, wordindex(info, 5))
  71. end
  72. else if fword = "EPSF" then
  73. do
  74.    copyfunc = "CopyEPSF"
  75.    epsfile   = substr(info, wordindex(info, 3))
  76. end
  77.  
  78. call ppm_ShowStatus("Working..")
  79.  
  80. do i = 1 to counter
  81.  
  82.    interpret "call "copyfunc"(source, boxes.i)"
  83.  
  84. end
  85.  
  86. do while dellist ~= ''
  87.  
  88.    parse var dellist box ';' dellist
  89.  
  90.    if box ~= '' then call ppm_DeleteBox(box)
  91.  
  92. end
  93.  
  94. exit_msg()
  95.  
  96. CopyText: procedure expose text
  97. do
  98.    parse arg source, dest
  99.  
  100.    call ppm_DeleteContents(dest)
  101.    call ppm_TextIntoBox(dest, text)
  102.    return
  103.  
  104. end
  105.  
  106. DelContents: procedure
  107. do
  108.    parse arg source, dest
  109.    call ppm_DeleteContents(dest)
  110.    return
  111. end
  112.  
  113. CopyEPSF: procedure expose epsfile
  114. do
  115.    parse arg source, dest
  116.  
  117.    call ppm_DeleteContents(dest)
  118.    call ppm_ImportEPSF(dest, epsfile)
  119.    return
  120. end
  121.  
  122. CopyBitMap: procedure expose bitmapfile
  123. do
  124.    parse arg source, dest
  125.  
  126.    call ppm_DeleteContents(dest)
  127.    call ppm_ImportBM(dest, bitmapfile)
  128.    return
  129. end
  130.  
  131.  
  132. CopyAll: procedure expose dellist
  133. do
  134.    parse arg source, dest
  135.  
  136.    dpos  = ppm_GetBoxPosition(dest)
  137.    dsize = ppm_GetBoxSize(dest)
  138.     ddata   = ppm_GetBoxFrameData(dest)
  139.     dframe  = ppm_GetBoxFrame(dest)
  140.     dboxoff = ppm_GetBoxOffset(dest)
  141.     dangle  = ppm_GetBoxAngle(dest)
  142.     dimperm = ppm_GetBoxTextWrap(dest)
  143.     dlock   = ppm_GetBoxLock(dest)
  144.     dhide   = ppm_GetBoxHide(dest)
  145.     dtrans  = ppm_GetBoxTransparent(dest)
  146.     dsoff   = ppm_GetBoxStandOff(dest)
  147.     dmargs  = ppm_GetBoxMargins(dest)
  148.  
  149.     left    = word(dpos, 1)
  150.     top     = word(dpos, 2)
  151.  
  152.     newbox  = ppm_CloneBox(source, 0, 0)
  153.  
  154.     call ppm_SetBoxSize(newbox, word(dsize, 1), word(dsize, 2))
  155.     call ppm_SetBoxAngle(newbox, dangle)
  156.     call ppm_SetBoxPosition(newbox, left, top)
  157.     call ppm_SetBoxTextWrap(newbox, word(dimperm, 1), word(dimperm, 2))
  158.     call ppm_SetBoxLock(newbox, dlock)
  159.     call ppm_SetBoxHide(newbox, dhide)
  160.     call ppm_SetBoxTransparent(newbox, dtrans)
  161.     call ppm_SetBoxFrame(newbox, dframe)
  162.     interpret "call ppm_SetBoxFrameData(newbox, "separate(ddata)")"
  163.     interpret "call ppm_SetBoxOffset(newbox, "separate(dboxoff)")"
  164.     interpret "call ppm_SetBoxStandOff(newbox, "separate(dsoff)")"
  165.     interpret "call ppm_SetBoxMargins(newbox, "separate(dmargs)")"
  166.  
  167.    dellist = dellist';'dest
  168.    return
  169. end
  170.  
  171. separate: procedure
  172. do
  173.     parse arg string
  174.  
  175.     output = ''
  176.  
  177.         cr = pos('0a'x, string)
  178.  
  179.         if cr ~= 0 then
  180.         do
  181.  
  182.                 do while string ~= ''
  183.  
  184.                         parse var string val '0a'x string
  185.                         output = output||val","
  186.                 end
  187.                 output = delstr(output, length(output))
  188.         end
  189.         else
  190.         do
  191.             wrds    = words(string)
  192.  
  193.             do i = 1 to wrds - 1
  194.  
  195.                    output = output||word(string, i)", "
  196.  
  197.             end
  198.  
  199.             output = output || word(string, wrds)
  200.  
  201.         end
  202.  
  203.     return(output)
  204.  
  205. end
  206.  
  207.  
  208. exit_msg: procedure
  209. do
  210.     parse arg message
  211.  
  212.     if message ~= '' then call ppm_Inform(1,message,)
  213.     call ppm_ClearStatus()
  214.     call ppm_AutoUpdate(1)
  215.     exit
  216. end
  217.  
  218.